package com.situ.mall.order.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.mall.common.util.Result;
import com.situ.mall.order.pojo.query.OrderInfoQuery;
import com.situ.mall.order.pojo.vo.OrderInfoVO;
import com.situ.mall.order.service.IOrderInfoService;
import com.situ.mall.pojo.entity.order.OrderInfo;
import jakarta.websocket.server.ServerEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单 前端控制器
 * </p>
 *
 * @author Sun Huijuan
 * @since 2024-10-14
 */
@RestController
@RequestMapping("/order/orderInfo")
public class OrderInfoController {
	@Autowired
	private IOrderInfoService orderInfoService;
	
	@PostMapping("/add")
	public Result add(@RequestBody OrderInfo orderInfo){
		//orderInfo里面有userId和addressId
		orderInfoService.add(orderInfo);
		return Result.ok("结算成功！");
	}
	
	@GetMapping("/list")
	public Result<List<OrderInfoVO>> list(OrderInfoQuery orderInfoQuery){
		List<OrderInfoVO> orderInfoList = orderInfoService.list(orderInfoQuery);
		return Result.ok(orderInfoList);
	}

}

